package com.adtg.peru;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
//import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class SplashActivity extends Activity {
	// private int TIME = 4000;

	// @Override
	// protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	// super.onCreate(savedInstanceState);
	// setContentView(R.layout.splashscreen);

	// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
	// WindowManager.LayoutParams.FLAG_FULLSCREEN);
	//
	// new Handler().postDelayed(new Runnable() {
	//
	// public void run() {
	// // TODO Auto-generated method stub
	// Intent intent=new Intent(SplashActivity.this,HomeActivity.class);
	// startActivity(intent);
	// }
	// }, TIME);

	// }

	private ImageView imgSplash = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.splashscreen);

		imgSplash = (ImageView) findViewById(R.id.imgSplash);
		Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_in);
		imgSplash.setAnimation(anim);
		anim.setAnimationListener(new AnimationListener() {

			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub

			}

			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub

			}

			public void onAnimationEnd(Animation animation) {
				Intent intent = new Intent(getApplicationContext(),
						HomeActivity.class);
				startActivity(intent);
				SplashActivity.this.finish();
			}
		});

	}

}
